package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type TextCenReq struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func SendCenors(message string) bool {
	client := censor.NewClient("iZ1OWLFgFOtMVFX4KjVs0cy1", "66tOwthkmDzXRitsJRQ9B9xLergvzpgG")

	res := client.TextCensor(message)
	fmt.Println(res)

	var req TextCenReq
	_ = json.Unmarshal([]byte(res), &req)
	if req.ConclusionType == 1 {
		return true
	}
	return false
}
